/*
 * DataBeanIntf.java
 *
 * Created on 01 June 2007, 14:15
 *
 * Copyright (C)
 * This program is free software; you can redistribute it and/or modify it under 
 * the terms of the GNU General Public License as published by the Free Software 
 * Foundation; either version 2 of the License, or (at your option) any later 
 * version.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT 
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 
 * details.
 * 
 * You should have received a copy of the GNU General Public License along with 
 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 
 * Place, Suite 330, Boston, MA 02111-1307 USA
 */

package com.grubby.databean;

import java.beans.IntrospectionException;

/**
 *
 * @author A. HARMEL-LAW. E: andrew.harmel.law@gmail.com
 * @version 0.1
 */
public interface DataBeanIntf {

    boolean DONT_WRAP_VARCHARS = false;
    boolean DO_WRAP_VARCHARS = true;

    /**
     * Returns a <String> which reflects the values of the bean attributes named
     * in the provided parameter as a comma seperated list
     * 
     * @param attributes The bean attributes to include within the CSV String
     * @return The comma seperated list of bean attributes
     * @throws IntrospectionException If one of the field names provided does not
     * have a JavaBean getter method available
     */
    String toCsv(String[] attributes) throws IntrospectionException;

    /**
     * Returns a <String> which reflects the values of the bean attributes as a 
     * comma seperated list
     * 
     * @return The comma seperated list of bean attributes
     * @throws IntrospectionException If one of the fields does not have a 
     * JavaBean getter method available
     */
    String toCsv() throws IntrospectionException;
    
    /**
     * Returns a <String> which reflects the values of the bean attributes named
     * in the provided parameter as a SQL-99 INSERT statement
     * 
     * @param fields The bean attributes to include within the SQL INSERT 
     * statement
     * @return The SQL-99 INSERT statement for the requested bean attributes
     * @throws NoSuchFieldException If one of the field names provided does not 
     * exist on the bean
     * @throws IntrospectionException If one of the field names provided does not
     * have a JavaBean getter method available
     */
    String toSql(String[] fields) throws NoSuchFieldException, IntrospectionException;
    
    /**
     * Returns a <String> which reflects the values of the bean attributes as a 
     * SQL-99 INSERT statement
     * 
     * @return The SQL-99 INSERT statement for the requested bean attributes
     * @throws IntrospectionException If one of the fields does not have a 
     * JavaBean getter method available
     */
    String toSql() throws NoSuchFieldException, IntrospectionException;
}
